#include <iostream>
#include <vector>
#include <string>
#include <set>
#include<map>
#include <algorithm>
using namespace std;

void brotherWords(vector<string>& dic, string& word, int pos) {
	multiset<string> orderdic;
	for (auto &item : dic) {
		if (item.size() == word.size())
			orderdic.insert(item);
	}
	int sum = 0;
	vector<string> ans;
	map<char, int> key;
	for (auto &ch : word)
		key[ch]++;
	for (auto &item : orderdic) {
		if (item != word) {
			bool flag = true;
			for (auto &ch : key) {
				int cnt = count(item.begin(), item.end(), ch.first);
				if (cnt != ch.second) {
					flag = false;
					break;
				}
			}
			if (flag) {
				sum++;
				ans.push_back(item);
			}
		}
	}
	cout << sum << endl;
	if (pos <= ans.size())
		cout << ans[pos - 1] << endl;
}

int main() {
	int N;
	cin >> N;
	vector<string> dic;
	for (int i = 0; i < N; i++) {
		string str;
		cin >> str;
		dic.push_back(str);
	}
	string word;
	cin >> word;
	int pos;
	cin >> pos;
	brotherWords(dic, word, pos);
}
